package com.graduation.controller;

import com.graduation.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @Author YaoQi
 * @Date 2018/3/21 23:55
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    // 注入商品处理业务类
    @Autowired
    private ProductService productService;

    /**
     * 获取商品数据
     *
     * @return json
     */
    @RequestMapping("/getList.json")
    public Map<String, Object> listProduct() {
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("productList", productService.getProductList());
        return resultMap;
    }

}
